<template>
  <!-- 待结算订单 -->
  <el-dialog title="待结算订单" :visible.sync="dialogVisible" :close-on-click-modal="false" width="1200px" append-to-body>
    <!-- <el-form class="search-form-new" :model="queryParams" ref="queryForm" :inline="true">
      <div class="search-box">
       
        <el-form-item label="日期" prop="acctDate">
          <el-date-picker  v-model="queryParams.acctDate" type="date" placeholder="请选择日期"  value-format="yyyyMMdd"  >
          </el-date-picker>
        </el-form-item>

        <el-form-item class="btns">
          <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" @click="resetQuery">重置/刷新</el-button>
        </el-form-item>
      </div>
    </el-form> -->
    <div class="table_box app-container" >
      <el-table border :data="tableData.records" stripe>
        <!-- <el-table-column prop="" label="订单来源" min-width="120">
          <template slot-scope="scope">
            <div>
              {{scope.row.sourceScen?commonMaps.orderSource[scope.row.sourceScen].label:'无'}}
            </div>
          </template>
        </el-table-column> -->
        <el-table-column prop="" label="订单类型" width="100">
          <template slot-scope="scope">
            <div>
              <el-tag type="" v-if="scope.row.type==2">B2B订单</el-tag>
              <span v-else>
                <el-tag :type="commonMaps.orderTypeMap[scope.row.orderType].type">{{scope.row.orderType?commonMaps.orderTypeMap[scope.row.orderType].label:'无'}}</el-tag>
              </span>

            </div>
          </template>
        </el-table-column>
        <el-table-column prop="no" label="订单编号" min-width="120"></el-table-column>
        <el-table-column prop="createTime" label="创建时间" min-width="160"></el-table-column>
        <el-table-column prop="goodsId" label="商品编号" min-width="120"></el-table-column>
        <!-- <el-table-column prop="gameName" label="游戏名称" min-width="120"></el-table-column>
        <el-table-column prop="" label="游戏账号" min-width="100">
          <template slot-scope="scope">
            <span>{{scope.row.realAccountNumber?scope.row.realAccountNumber:scope.row.accountNumber}}</span>
          </template>
        </el-table-column>
     
        <el-table-column prop="platformAmount" label="商品价格" min-width="100"></el-table-column> -->
        <el-table-column prop="saleChannel" label="买家昵称" min-width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.type==1" class="link">{{ scope.row.saleChannel }}</span>

            <span v-if="scope.row.type==2" class="link" >{{ scope.row.saleTenantName }}</span>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="guaranteeAmount" label="包赔" min-width="200">
          <template slot-scope="scope">
            <span>包赔费：{{ scope.row.guaranteeAmount }}</span><br />
            <span v-if="scope.row.guaranteeType">包赔类型：{{ scope.row.guaranteeType }}</span>
          </template>
        </el-table-column> -->
        <el-table-column prop="actualAmount" label="实付金额" min-width="100"></el-table-column>
        <el-table-column prop="" label="支付状态" min-width="120">
          <template slot-scope="scope">
            <span>{{
                    scope.row.salePay?commonMaps.buyerPayState[scope.row.salePay]: commonMaps.buyerPayState["1"]
                  }}</span>
            <span style="color: red;" v-if="scope.row.payStatus==5">(已退款)</span><br />
            <span v-if="scope.row.afterSaleState">售后{{scope.row.afterSaleState?commonMaps.afterOrderStateMap[scope.row.afterSaleState]:''}} <br /></span>
          
          </template>
        </el-table-column>
        <el-table-column prop="supplyChannel" label="供货商" min-width="130">
         
        </el-table-column>
    
        <el-table-column prop="saleUserNickname" label="销售人" min-width="100"></el-table-column>
        <!-- <el-table-column prop="remark" label="备注" min-width="120"></el-table-column> -->
      </el-table>
      <pagination v-show="tableData.total > 0" :total="tableData.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
    </div>
  </el-dialog>

</template>
<script>
import orderApi from "@/api/pickUp/order.js";
export default {
  name: "",
  data() {
    return {
      dialogVisible: false,
      timer: [],
      tableData: {
        records: [],
        total: 0,
      },

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        acctDate: "",
      },
      defaultDate: "",
    };
  },
  created() {},
  computed: {
    formatTime() {
      return (time) => {
        const year = time.slice(0, 4);
        const month = time.slice(4, 6);
        const day = time.slice(6, 8);
        const hh = time.slice(8, 10);
        const mm = time.slice(10, 12);
        const ss = time.slice(12, 14);
        return `${year}-${month}-${day} ${hh}:${mm}:${ss}`;
      };
    },
  },
  methods: {
    open() {
      // const now = new Date();
      // const year = now.getFullYear();
      // const month = now.getMonth() + 1;
      // const day = now.getDate();

      // this.queryParams.acctDate = `${year}${month > 9 ? month : "0" + month}${
      //   day > 9 ? day : "0" + day
      // }`;
      this.dialogVisible = true;
      this.getList();
    },
    // 获取列表
     getList() {
      this.loading = true;
      this.queryParams.isHuifu=2
      this.queryParams.orderStatus=4
      this.queryParams.dataType='all'
      orderApi.getListNew(this.queryParams).then((res) => {
        this.loading = false;
        this.tableData.records = res.rows;
        this.tableData.total = res.total;
      });
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.timer = [];
      this.handleQuery();
    },
    resetQuery() {
      this.timer = [];
      this.queryParams = {
        pageNum: 1,
        pageSize: 20,
        createTimeStart: "",
        createTimeEnd: "",
      };
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
.table_box{
  min-height: 600px;
  padding: 0;
  border-radius: 0;

}
</style>
